home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1994 November: Tool Chest / Dev.CD Nov 94.toast / Sample Code / Snippets / Toolbox / DateThing / DateThing • Read Me < prev    next >
Encoding:
Text File  |  1993-08-05  |  2.1 KB  |  50 lines  |  [TEXT/MPS ]

  1. DateThing
  2.  
  3. A sample of how to write one of those date things as in the General control panel.
  4.  
  5. This is a date thing, one of those things whereby a user can change the
  6. month, day, and year in one operation. This is written to allow the user
  7. to select a range of dates, but can be modified to adjust anything that has
  8. a range, like hours/minutes, degrees/seconds, feet/inches, and so on.
  9.  
  10. All the code to do the date thing is in the file DateDialog.c, the other
  11. file is just support for the basic shell.
  12.  
  13. Interesting bits;
  14.  
  15. You can modify a number three ways in this sample
  16. 1) Hit the picture of the up or down arrow to move a number one position.
  17.     If the user keeps holding down on the arrow, the number will continue to
  18.     increase.  I'm delaying 8 ticks between numeric increases (the traditional
  19.     control-invert delay time), you may want to modify that.  In products
  20.     I usually make this variable, the longer the user holds down the faster the
  21.     number will continue to change
  22.  
  23. 2) Arrow keys
  24.     Hittin the left or down arrow drops the selected number down one.  
  25.     Right and up increase the number one.  Pretty boring.
  26.     
  27. 3) Numeric input.
  28.     If the user hits a number key, I replace the selected number with the number
  29.     they have hit.  This also allows multi-digit input, if the user hits
  30.     two numbers rapidly (within 60 ticks of each other) then both numbers are 
  31.     entered.  Y'Know, like if they hit 1 and 0 within 60 ticks of each other
  32.     I interprete that as 10.
  33.  
  34. Navigating is with the tab key to move between fields, or mouse clicks on a field.
  35.  
  36. Notice that I am using the System (for the most part) to do any date validity
  37. checking and conversion.  It's already in there, why re-write it?
  38.  
  39. What else?  I thought about making this a CDEF, and still might.  I'm using 
  40. a global to keep track of the dates in the dialog, you may want to put it 
  41. somewhere else.
  42.  
  43. One thing I'm NOT doing yet, that's looking at the international resources 
  44. ('itl0' and 'itl1') to see what the user has set up as date ordering.  
  45. Sorry.
  46.  
  47. Enjoy, and report any bugs, if I don't know I can't fix.
  48.  
  49. C.K. Haun <TR>
  50. Apple Developer Technical Support